﻿/**
 * ...
 * @author js
 */

package tab;

import flash.events.KeyboardEvent;
import flash.Lib;
import flash.text.TextField;
import flash.text.TextFieldType;
import gui.hug.HUGInputFieldSB;
import gui.hug.HUGSprite;
import gui.hug.HUGTabbedPanel;
import gui.hug.Tab;

import list.NewList;
import list.OpenTabEvent;

import client.Item;

class FindItemsTag extends Tab
{
	private static inline var TITLE = "Поиск по категориям (новостей)";
	private var inp		 	: TextField;
	private var sprite 		: HUGSprite;
	private var uid			: Int;
		
	public function new(panel : HUGTabbedPanel = null, uid : Int) 
	{
	 sprite = new HUGSprite();	
	 inp = new TextField();
	 inp.x = inp.y = 10;
	 inp.height = 20;
	 inp.width = 400;
	 inp.type = TextFieldType.INPUT;
	 inp.border = true;
	 
	 sprite.addChild(inp);
     Lib.current.addEventListener(KeyboardEvent.KEY_DOWN, hitEnter);		
	 
	 super(sprite, TITLE, 1, panel, true);
	}
	
    function hitEnter(event:KeyboardEvent)
    {
        if (event.keyCode == 13 && inp.text != "")
        {
			this.getPanel().addTab(new tab.FindTab(inp.text, panel, uid));
					
        }
    }	
}

